use std::fs;
use std::path::PathBuf;
use tracing::log::{error, info};

//目录清理
pub struct DirCleaner(pub PathBuf);
impl Drop for DirCleaner {
    fn drop(&mut self) {
        if let Err(e) = fs::remove_dir_all(&self.0) {
            error!("删除临目录失败 {:?}: {:?}", self.0, e);
        } else {
            info!("删除临目录 {:?}", self.0);
        }
    }
}
